Skip to content

MkBlockQuote

:fa-brands-github: Show source on GitHub

BlockQuote node.

Example: Regular

Jinja

{{ "Some text" | MkBlockQuote }}

Python

MkBlockQuote()

Some text

> Some text
<blockquote>
<p>Some text</p>
</blockquote>
    Some text
MkBlockQuote
╰── MkText('Some text')

Example: Nested

Jinja

{{ "Nested!" | MkBlockQuote | MkBlockQuote }}

Python

MkContainer()

Nested!

Nested!

> Nested!


> > Nested!
<blockquote>
<p>Nested!</p>
<blockquote>
<p>Nested!</p>
</blockquote>
</blockquote>
MkContainer
├── MkBlockQuote()
│   ╰── MkText('Nested!')
╰── MkBlockQuote()
├── MkBlockQuote()
│   ╰── MkText('Nested!')

Bases: MkContainer

get_content

get_content() -> NodeContent
Name Children Inherits
MkContainer
mknodes.basenodes.mkcontainer
A node containing other MkNodes.
graph TD
  1647548858["mkblockquote.MkBlockQuote"]
  835538629["mkcontainer.MkContainer"]
  1956333208["mkcontainer.MkContainerBase"]
  1359323199["mknode.MkNode"]
  2751680898["builtins.object"]
  835538629 --> 1647548858
  1956333208 --> 835538629
  1359323199 --> 1956333208
  2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mkblockquote/metadata.toml
[metadata]
icon = "mdi:format-quote-open"
name = "MkBlockQuote"

[examples.regular]
title = "Regular"
jinja = """
{{ "Some text" | MkBlockQuote }}
"""

[examples.nested]
title = "Nested"
description = "We can also nest blocks, they will adjust their delimiters automatically."
jinja = """
{{ "Nested!" | MkBlockQuote | MkBlockQuote }}
"""

[output.markdown]
template = """
{{ node.get_items() | join(node.block_separator) | indent(width="> ", first=True) | rstrip("\n") }}

"""

# [output.html]
# template = """
# <blockquote>
# {{ node.get_items() | join(node.block_separator)  }}
# </blockquote>
# """

[output.rst]
template = """
{{ node.get_items() | join(node.block_separator) | indent(width="    ", first=True) | rstrip("\n") }}

"""
mknodes.basenodes.mkblockquote.MkBlockQuote
class MkBlockQuote(mkcontainer.MkContainer):
    """BlockQuote node."""

    ICON = "material/format-quote-open"
    STATUS = "new"

    def get_content(self) -> resources.NodeContent:
        """Single-pass: get content and apply blockquote indentation."""
        content = super().get_content()
        md = textwrap.indent(content.markdown, "> ").rstrip("\n") + "\n"
        return resources.NodeContent(markdown=md, resources=content.resources)

    def to_md_unprocessed(self) -> str:
        content = self.get_content()
        return content.markdown